/* ----------------------------------------------------------------------------
* File: api_event_dispatcher_impl.h
*
* Desc: Dispatcher for Skype API events - implementation
*
* Created: 30/07/2011, by Alexey Korshunov
* ---------------------------------------------------------------------------- */
#ifndef _API_EVENT_DISPATCHER_IMPL_H_
#define _API_EVENT_DISPATCHER_IMPL_H_

#include "error.h"
#include "event_sink.h"
#include "api_event_dispatcher.h"
#include "api_proxy.h"

namespace SkypeProtection
{
	class APIEventDispatcherImpl
		: public APIEventDispatcher
		, public APIProxy
	{
	public:
		explicit APIEventDispatcherImpl(const APIEventDispatcherParams& params);
		~APIEventDispatcherImpl();

		// SkypeProxy implementation
		virtual Common::Error RunLogic(SKYPE4COMLib::ISkype* skype);

	private:
		Common::Error StartProxyProcess(SKYPE4COMLib::ISkype* skype, EventSink* eventSink);
		Common::Error StopProxyProcess(SKYPE4COMLib::ISkype* skype, EventSink* eventSink);

		std::auto_ptr<APIEventHandler> m_EventHandler;
		std::auto_ptr<AttachEventHandler> m_AttachHandler;
		bool m_dispatch_events;
	};
}

#endif // _API_EVENT_DISPATCHER_IMPL_H_